import { Button } from 'antd';
import React, { useCallback } from 'react';
import request from '@/utils/request';

function NewVersionButton({ processId, className, onCreated }) {
  const createNewVersion = useCallback(() => {
    request.post(`/process/createNewVersion?processId=${processId}`).then(() => onCreated());
  }, [onCreated, processId]);

  return (
    <Button icon="plus" type="primary" onClick={createNewVersion} className={className}>
      新建版本
    </Button>
  );
}

export default NewVersionButton;
